@use "./variables" as *;
@use "./keyframe-animations" as *;

@source "../node_modules/streamdown/dist/index.js";
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 0 0% 3.9%;
    --card: 0 0% 100%;
    --card-foreground: 0 0% 3.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 0 0% 3.9%;
    --primary: 231 58% 64%;
    --primary-foreground: 0 0% 100%;
    --secondary: 0 0% 96.1%;
    --secondary-foreground: 0 0% 9%;
    --muted: 0 0% 96.1%;
    --muted-foreground: 0 0% 45.1%;
    --accent: 0 0% 96.1%;
    --accent-foreground: 0 0% 9%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 98%;
    --border: 240 5.9% 90%;
    --input: 240 5.9% 90%;
    --ring: 231 58% 64%;
    --radius: 0.5rem;
    --sidebar-background: 220 15% 80%;
    --sidebar-foreground: 220 16% 16%;
    --sidebar-primary: 231 58% 54%;
    --sidebar-primary-foreground: 0 0% 98%;
    --sidebar-accent: 220 15% 72%;
    --sidebar-accent-foreground: 220 16% 16%;
    --sidebar-border: 220 14% 68%;
    --sidebar-ring: 231 58% 64%;
    --json-key: 231 58% 64%;
    --tooltip: 222 47% 11%;
    --tooltip-foreground: 0 0% 100%;
  }

  .dark {
    --background: 0 0% 3.9%;
    --foreground: 0 0% 98%;
    --card: 0 0% 3.9%;
    --card-foreground: 0 0% 98%;
    --popover: 0 0% 3.9%;
    --popover-foreground: 0 0% 98%;
    --primary: 231 58% 64%;
    --primary-foreground: 0 0% 100%;
    --secondary: 0 0% 14.9%;
    --secondary-foreground: 0 0% 98%;
    --muted: 0 0% 14.9%;
    --muted-foreground: 0 0% 63.9%;
    --accent: 0 0% 14.9%;
    --accent-foreground: 0 0% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 0 0% 98%;
    --border: 0 0% 14.9%;
    --input: 0 0% 14.9%;
    --ring: 231 58% 64%;
    --sidebar-background: 240 5.9% 10%;
    --sidebar-foreground: 240 4.8% 95.9%;
    --sidebar-primary: 231 58% 54%;
    --sidebar-primary-foreground: 0 0% 100%;
    --sidebar-accent: 240 3.7% 15.9%;
    --sidebar-accent-foreground: 240 4.8% 95.9%;
    --sidebar-border: 240 3.7% 15.9%;
    --sidebar-ring: 231 58% 64%;
    --json-key: 231 58% 64%;
    --tooltip: 222 47% 16%;
    --tooltip-foreground: 0 0% 100%;
  }
}

@layer base {
  * {
    @apply border-border;
  }

  body {
    @apply bg-background text-foreground;
  }

  html,
  body {
    overscroll-behavior-x: none; /* Prevents back/forward swipe navigation */
  }
}

@layer utilities {
  /* Hide scrollbar for Chrome, Safari and Opera */
  .no-scrollbar::-webkit-scrollbar {
    display: none;
  }

  /* Hide scrollbar for IE, Edge and Firefox */
  .no-scrollbar {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
  }

  .editor-wrapper .monaco-editor {
    border-radius: 8px;
  }
  .editor-wrapper .overflow-guard {
    border-radius: 8px;
    border: 1px solid hsl(var(--border));
  }
  /* Custom styles for the Monaco editor suggestion widget */
  .editor-wrapper .monaco-editor .suggest-widget {
    border-radius: 4px;
    overflow: hidden;
    /* border: 1px solid var(--border-color); */
    /* box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1); */
    min-width: 280px !important;
  }

  /* Style individual suggestion items */
  .editor-wrapper .monaco-editor .suggest-widget .monaco-list-row {
    white-space: nowrap !important;
    overflow: visible !important;
  }

  /* Make the suggestion list container wider */
  .editor-wrapper .monaco-editor .suggest-widget > .message,
  .editor-wrapper .monaco-editor .suggest-widget > .tree {
    width: auto !important;
    min-width: 100% !important;
  }

  /* Ensure the details pane is wide enough */
  .editor-wrapper .monaco-editor .suggest-widget .details-view {
    padding: 8px;
    width: auto !important;
    min-width: 100% !important;
  }

  /* Style the highlighted/selected suggestion */
  .editor-wrapper .monaco-editor
    .suggest-widget
    .monaco-list
    .monaco-list-row.focused {
    background-color: hsl(var(--accent)) !important;
    color: hsl(var(--accent-foreground)) !important;
  }

  /* Style the matching text highlight */
  .editor-wrapper .monaco-editor
    .suggest-widget
    .monaco-list
    .monaco-list-row.focused
    .highlight {
    color: hsl(var(--accent-foreground)) !important;
    font-weight: bold;
  }

  /* Style the matching text in non-selected items */
  .editor-wrapper .monaco-editor
    .suggest-widget
    .monaco-list
    .monaco-list-row
    .highlight {
    color: hsl(var(--primary)) !important;
    font-weight: bold;
  }

  .editor-wrapper .monaco-editor .monaco-hover {
    background-color: hsl(var(--popover));
    border: 1px solid hsl(var(--border));
    border-radius: 4px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  }
}
